runOnStartup(async runtime => {
    
    lib.graph_render.backcc = "[background=#A9A9A9]"
    runtime.objects.GraphText.addEventListener("instancecreate", (e) => {

        runtime.addEventListener("tick", () => {
            lib.graph_render["render:debug:infomation"]()

        })
    })
})
lib.graph_render = {

    "r":(text)=>{
        var _gra = runtime.objects.GraphText?.getFirstInstance()
        var _gracc = lib.graph_render.backcc
        var hastext =_gra.text
        _gra.text=`${hastext} \n ${text}`

    },

    "render:debug:infomation": () => {
        var _gra = runtime.objects.GraphText?.getFirstInstance()
        var _gracc = lib.graph_render.backcc
        var _pl = runtime.objects.Pl?.getFirstInstance()
        if (_pl == null) return

        /**
         * @type {I3DCameraObjectType}
         */
        var fpscamera = runtime.objects.fpscam
        var version = "0.0.1"
        var fps = lib.c.call("c3fps")
        var cpu = lib.c.call("c3cpu")
        var pl_posx = _pl.x
        var pl_posy = _pl.y
        var pl_z = _pl.zElevation
        var _fpscamerapos = fpscamera.getCameraPosition()
        var isfly = String(lib.fpsController.fly)
        var isgod = String(lib.addon_cam.debugcam)
        var fogstate = null
        
        
        _gra.text = `${_gracc} version:${version}
        fps:${fps} 
        cpu:${cpu}
        p:(${pl_posy}:${pl_posx}) 
        camera:${_fpscamerapos} 
        isfly:${isfly}  
        isgod:${isgod}
        fog:${fogstate} 
        pl_z:${pl_z} 
        `
    },

}